---
title: useBreakpointValue
description: "`useBreakpointValue` is a custom hook that returns the value of the current breakpoint from the provided object. This hook monitors changes in the window size and returns the appropriate value."
storybook: hooks-usebreakpointvalue--basic
source: hooks/use-breakpoint
---

```tsx preview functional client
const breakpoint = useBreakpoint()
const bg = useBreakpointValue({
  base: "red.500",
  sm: "purple.500",
  md: "yellow.500",
  lg: "green.500",
  xl: "blue.500",
  "2xl": "pink.500",
})

return (
  <Box
    bg={bg}
    color="white"
    p="md"
    transitionDuration="moderate"
    transitionProperty="all"
  >
    The current breakpoint is "{breakpoint}"
  </Box>
)
```

## Usage

:::code-group

```tsx [package]
import { useBreakpointValue } from "@yamada-ui/react"
```

```tsx [alias]
import { useBreakpointValue } from "@/components/ui"
```

```tsx [monorepo]
import { useBreakpointValue } from "@workspaces/ui"
```

:::

```tsx
const bg = useBreakpointValue({
  base: "red.500",
  sm: "purple.500",
  md: "yellow.500",
  lg: "green.500",
  xl: "blue.500",
  "2xl": "pink.500",
})
```
